import React, { useEffect, useState } from 'react'
import { Link } from "react-router-dom"
import "./goods.css"
function Goods(props) {
    let { news, reqCartadd } = props
    let uid = JSON.parse(sessionStorage.getItem("info")).uid
    return (
        <div className="goods">
            <div className="goods_logo">新人专享</div>
            <div className="clear home_goods">
                {news.map((item) => (
                    <Link className="goods_box" to="/index/shop" key={item.id} >
                        {/* <div>id:{item.id}</div> */}
                        <img src={item.img} alt="" />
                        {/* <div>{item.goodsname}</div> */}
                        <div className="goods_box_btn">
                            <div className="goods_price">
                                <p >{item.price}</p>
                                <div><del>{item.market_price}</del></div>
                            </div>

                            <button className="goods_btn iconfont icon-gouwuche" onClick={() => reqCartadd({ goodsid: item.id, type: 1, uid, num: 1 })}></button>
                        </div>

                    </Link>

                ))}
            </div>

        </div>
    )
}
export default React.memo(Goods);